package com.hpq.common.exception;

import lombok.Data;

/**
 * 业务异常捕获
 */
@Data
public class BusinessException extends RuntimeException{
    protected Integer errorCode;
    protected String errorMsg;
    public BusinessException(String  errorMsg) {
        super(errorMsg);
        this.errorCode = HttpStatusEnum.BUSINESS_ERROR.getCode();
        this.errorMsg = errorMsg;
    }
    public BusinessException(Integer errorCode,String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BusinessException(ErrorEnum errorEnum ) {
        super(errorEnum.getErrorMsg());
        this.errorCode = errorEnum.getErrorCode();
        this.errorMsg = errorEnum.getErrorMsg();
    }
}
